<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


 <link rel="stylesheet" href="model.css" />
  <?php include("head.php"); ?>
 <?php include("entete.php"); ?>
   <?php include("menu.php"); ?>
<?php


<?php
// Parametres mysql à remplacer par les vôtres
define('DB_SERVER', 'localhost'); // serveur mysql
define('DB_SERVER_USERNAME', 'root'); // nom d'utilisateur
define('DB_SERVER_PASSWORD', 'sgbd2011'); // mot de passe
define('DB_DATABASE', 'association'); // nom de la base


try{
  $pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
  $bdd = new PDO('mysql:host='.DB_SERVER.';dbname='.DB_DATABASE, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, $pdo_options);
  

  $id_evt = $_GET['idEvenement'];
  $nom_evt = $_GET['nomEvenement'];
 
  $sql = "DELETE FROM AGENDA WHERE ID_EVENT = '$id_evt'";

  $bdd->exec($sql);

  $sql ="DELETE FROM ORGANISATION WHERE ID_EVENT='$id_evt'";

  $bdd->exec($sql);

  $sql ="DELETE FROM PARTICIP_ADHERENT WHERE ID_EVENT='$id_evt'";

  $bdd->exec($sql);

  $sql ="DELETE FROM PARTICIP_EXTE WHERE ID_EVENT='$id_evt'";
  
  $bdd->exec($sql);

 $sql ="DELETE FROM EVENEMENT WHERE ID_EVENT='$id_evt'";
  
  $bdd->exec($sql);


  echo $nom_evt.' a bien été supprimé';
  
}
catch (Exception $e)
{
  die('Erreur : ' . $e->getMessage());
} 
?>

 <?php include("pied_de_page.php"); ?>